package com.hb.trade.server.project.opening.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hb.core.pojo.enums.TradeWebsocketMsgEnum;
import com.hb.core.pojo.parent.PageResult;
import com.hb.core.pojo.project.opening.dto.OpeningBidInfoDTO;
import com.hb.core.pojo.project.opening.dto.OpeningBidTenderDTO;
import com.hb.core.pojo.project.opening.dto.OpeningBidTenderRecordDTO;
import com.hb.core.pojo.project.opening.entity.OpeningBidInfo;
import com.hb.core.pojo.project.opening.entity.OpeningBidTender;
import com.hb.core.pojo.project.section.dto.BidSectionDTO;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * 开标大厅Service
 *
 * @author Lix1ang
 * @date 2021-11-24 11:20:54
 */
public interface OpeningBidHallService extends IService<OpeningBidInfo> {

    /**
     * 根据项目Id查询今日开标标段分页
     *
     * @param bidSectionDTO
     * @return
     */
    PageResult pageTodayBidOpeningSection(BidSectionDTO bidSectionDTO);

    /**
     * 根据项目Id查询今日开标标段分页
     *
     * @param bidSectionDTO
     * @return
     */
    List<BidSectionDTO> listTodayBidOpeningSection(BidSectionDTO bidSectionDTO);


    /**
     * 根据项目Id查询今日开标标段分页
     *
     * @param bidSectionDTO
     * @return
     */
    PageResult pageTodayOpeningSection(BidSectionDTO bidSectionDTO);

    /**
     * 获取开标大厅实时记录数据
     *      根据当前登录用户，判断用户角色属于招标方还是投标方，返回不同的记录。
     *      招标方返回所有记录，投标方返回自己操作记录。
     *
     * @param openingBidTender
     * @return
     */
    List<OpeningBidTenderRecordDTO> listBidOpeningRecord(OpeningBidTender openingBidTender);

    /**
     * 获取开标大厅投标方状态数据
     *
     * @param openingBidTender
     * @return
     */
    List<OpeningBidTenderDTO> listBidOpeningTender(OpeningBidTender openingBidTender);

    /**
     * 根据标段Id查询 总投标人数、有效投标人数、无效投标人数、已解密人数、已签名人数
     *
     * @param id 开标记录主键Id
     * @author lixiang
     * @return
     */
    Map countHallInfo(Long id);

    /**
     * 根据开标记录Id查询所有投标方开标一览表数据
     *
     * @param openingBidInfo
     * @return
     */
    List<OpeningBidTender> listBidOpeningSchedule(OpeningBidInfo openingBidInfo);



    //------------------------------------------  投标方端接口  ------------------------------------------

    /**
     * 构造唱标词，生成唱标文件
     *
     * @param openingBidInfo
     */
    void generateSingAudio(OpeningBidInfo openingBidInfo);



    //--------------------- 中标结果公示查询开标打厅记录-------------------------

    /**
     * @Description: 根据标段id查询开标一览表
     * @Author: zhongdl
     * @Date:2022/1/27 9:26
     * @param page:分页对象
     * @param sectionId:标段id
     * @param orgName:企业名称
     * @return: {@link PageResult< OpeningBidTender> }
     **/
    PageResult<OpeningBidTender> pageOpeningBidTender(Page<OpeningBidTender> page,Long sectionId,String orgName);

    /**
     *
     * @Description: 查询标段的中标金额
     * @Author: zhongdl
     * @Date:2022/2/7 9:01
     * @param sectionId: 标段id
     * @param orgId: 企业id
     * @return: {@link BigDecimal }
     **/
    BigDecimal getWinAmount(Long sectionId,Long orgId);
}
